package rabbit.flt.common.metrics;

import rabbit.flt.common.Metrics;
import rabbit.flt.common.MetricsType;

public class ZookeeperMetrics extends Metrics {

    /**
     * 最大内存，单位M
     */
    private long maxHeapMemory;

    /**
     * 已用内存，单位M
     */
    private long usedHeapMemory;

    /**
     * 采样时间
     */
    private long samplingTime;

    /**
     * 节点数
     */
    private int nodeCount;

    /**
     * 会话数
     */
    private long sessionCount;

    /**
     * 连接数
     */
    private int connectionCount;

    /**
     * 监听器个数
     */
    private int watchCount;

    /**
     * zk节点状态，leader，follower，observer，standalone等等
     */
    private String state;

    /**
     * 积压的请求
     */
    private int pendingRequests;

    /**
     * 最大延迟
     */
    private long maxLatency;

    /**
     * 最小延迟
     */
    private long minLatency;

    /**
     * 线程数
     */
    private int threadCount;

    /**
     * 平均延迟
     */
    private long averageLatency;

    /**
     * zk版本
     */
    private String version;

    public ZookeeperMetrics() {
    }

    public ZookeeperMetrics(int nodeCount, long sessionCount, int connectionCount, int watchCount) {
        this();
        this.setNodeCount(nodeCount);
        this.setSessionCount(sessionCount);
        this.setConnectionCount(connectionCount);
        this.setWatchCount(watchCount);
    }

    @Override
    public String getMetricsType() {
        return MetricsType.ZOOKEEPER.name();
    }

    public int getNodeCount() {
        return nodeCount;
    }

    public void setNodeCount(int nodeCount) {
        this.nodeCount = nodeCount;
    }

    public long getSessionCount() {
        return sessionCount;
    }

    public void setSessionCount(long sessionCount) {
        this.sessionCount = sessionCount;
    }

    public int getConnectionCount() {
        return connectionCount;
    }

    public void setConnectionCount(int connectionCount) {
        this.connectionCount = connectionCount;
    }

    public int getWatchCount() {
        return watchCount;
    }

    public void setWatchCount(int watchCount) {
        this.watchCount = watchCount;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public int getPendingRequests() {
        return pendingRequests;
    }

    public void setPendingRequests(int pendingRequests) {
        this.pendingRequests = pendingRequests;
    }

    public long getMaxLatency() {
        return maxLatency;
    }

    public void setMaxLatency(long maxLatency) {
        this.maxLatency = maxLatency;
    }

    public long getMinLatency() {
        return minLatency;
    }

    public void setMinLatency(long minLatency) {
        this.minLatency = minLatency;
    }

    public long getAverageLatency() {
        return averageLatency;
    }

    public void setAverageLatency(long averageLatency) {
        this.averageLatency = averageLatency;
    }

    public long getSamplingTime() {
        return samplingTime;
    }

    public void setSamplingTime(long samplingTime) {
        this.samplingTime = samplingTime;
    }

    public int getThreadCount() {
        return threadCount;
    }

    public void setThreadCount(int threadCount) {
        this.threadCount = threadCount;
    }

    public long getMaxHeapMemory() {
        return maxHeapMemory;
    }

    public void setMaxHeapMemory(long maxHeapMemory) {
        this.maxHeapMemory = maxHeapMemory;
    }

    public long getUsedHeapMemory() {
        return usedHeapMemory;
    }

    public void setUsedHeapMemory(long usedHeapMemory) {
        this.usedHeapMemory = usedHeapMemory;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }
}
